local ty_1v2_cc = fk.CreateSkill {
    name = "ty_1v2_cc&",
}

Fk:loadTranslationTable {
    ["ty_1v2_cc&"] = "陈仓",
    [":ty_1v2_cc&"] = "弃牌阶段结束时，你可以弃置任意角色区域内至多共计X张牌(X为5-你的手牌数，至少为1)",

}

ty_1v2_cc:addEffect(fk.EventPhaseEnd, {
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(ty_1v2_cc.name) and player.phase == Player.Discard and
            table.find(player.room.alive_players, function(p)
                return not p:isAllNude()
            end)
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local x = math.max(5 - player:getHandcardNum(), 1)
        local to, cards
        for i = 1, x, 1 do
            if x == 0 then return end
            local targets = table.filter(room.alive_players, function(p)
                return not p:isAllNude()
            end)
            if #targets == 0 then return end
            targets = room:askToChoosePlayers(player, {
                targets = targets,
                min_num = 1,
                max_num = 1,
                prompt = "陈仓：请选择一名角色，弃置其至多" .. x .. "张牌",
                skill_name = ty_1v2_cc.name,
            })
            if #targets == 0 then return end
            to = targets[1]
            if to == player then
                cards = table.filter(player:getCardIds("hej"), function(id)
                    return not player:prohibitDiscard(id)
                end)
                cards = room:askToCards(player, {
                    min_num = 1,
                    max_num = x,
                    include_equip = true,
                    skill_name = ty_1v2_cc.name,
                    pattern = tostring(Exppattern { id = cards }),
                    prompt = "陈仓：请选择至多" .. x .. "张牌",
                    cancelable = false,
                    expand_pile = player:getCardIds("j"),
                })
            else
                cards = room:askToChooseCards(player, {
                    target = to,
                    min = 1,
                    max = x,
                    flag = "hej",
                    skill_name = ty_1v2_cc.name,
                    prompt = "陈仓：请选择至多" .. x .. "张牌",
                })
            end
            room:throwCard(cards, ty_1v2_cc.name, to, player)
            room:addPlayerMark(player, "ty_1v2_cc-tuan", #cards)
            x = x -#cards
        end
    end,
})

return ty_1v2_cc
